using System;
using System.Collections.Generic;
using System.Text;

namespace ImagesMath.Transformations
{
    public class Translation : Transformation
    {

        public Translation(VR3 Step) : base(new M33(),Step,(new M33()),-Step) {}

        #region Functions

        public VR3  GetStep()
        {
          return T;
        }

        public void SetStep(ref VR3 Step)
        {
          T    =  Step;
          invT = -Step;
        }

        /// Compute the concatenation of (*this) and Tr [ (*this)*Tr ]
        public virtual Transformation rightMultiply(Transformation Tr)
        {
            return new Transformation(Tr.L, T + Tr.T, Tr.InvL, Tr.InvT + Tr.InvL * invT);
        }
        /// Compute the concatenation of Tr and (*this) [ Tr*(*this) ]
        public virtual Transformation leftMultiply(Transformation Tr)
        {
            return new Transformation(Tr.L, Tr.T + Tr.L * T, Tr.InvL, invT + Tr.InvT);
        }
        public virtual PR3 transform(PR3 p)
        {
            return p + T;
        }
        public virtual PR3 invTransform(PR3 p)
        {
            return p + invT;
        }
        public virtual VR3 transform(VR3 v)
        {
            return v;
        }
        public virtual VR3 invTransform(VR3 v)
        {
            return v;
        }

        #endregion

    }
}
 